package edu.gatech.cs2340.group7.wheresmystuffapp.model;

import java.util.Calendar;

/**
 * 
 * @author tbowling3
 * Represents an object which is either found, lost, or a donation
 */
public abstract class Item {
	private String category;
	private String name;
	private String description;
	private String username;
	private boolean isResolved;
	private ItemLocation itemLocation;
	private byte[] picture;
	protected CustomDate dateEntered;

	/**
	 * Creates the item
	 * @param user The account name of the user responsible for reporting this item
	 * @param category The category of the item
	 * @param name The name of the item
	 * @param description A description of the item
	 * @param location The location where the item was lost/found
	 * @param picture The id of the picture
	 */
	public Item(String user,String category, String name, String description, ItemLocation il, byte[] pic) {
		this.username = user;
		this.setCategory(category);
		this.setName(name);
		this.setDescription(description);
		this.setLocation(il);
		this.setPicture(pic);
		
		int month = Calendar.MONTH;
		int day = Calendar.DAY_OF_MONTH;
		int year = Calendar.YEAR;
		String date = month + "-" + day + "-" + year;
		dateEntered = new CustomDate(date);
	}
	
	/**
	 * Compares two items
	 * @param item Item to be compared to
	 * @return
	 */
	public int compareTo(Item item) {
		int out = -1;
		
		if(item != null) {
			out = 0;
		}
		
		return out;
	}
	
	/**
	 * Tests to see if the two items are equal
	 * @param item Item to be compared to
	 * @return True if the items are the same and false otherwise
	 */
	public boolean equals(Item item) {
		boolean out = false;
		
		if(item != null) {
			out = true;
		}
		
		return out;
	}

	/**
	 * @return the category
	 */
	public String getCategory() {
		return category;
	}

	/**
	 * @param category The category to set
	 */
	public void setCategory(String category) {
		this.category = category;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name The name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description The description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return True is the item has been resolved, and false otherwise
	 */
	public boolean isResolved() {
		return isResolved;
	}

	/**
	 * @param isResolved the isResolved to set
	 */
	public void setResolved(boolean isResolved) {
		this.isResolved = isResolved;
	}

	/**
	 * @return the location
	 */
	public ItemLocation getItemLocation() {
		return itemLocation;
	}
	
	/**
	 * 
	 * @return The username of the account responsible for reporting this item
	 */
	public String getUsername(){
		return username;
	}

	/**
	 * @param location the location to set
	 */
	public void setLocation(ItemLocation il) {
		this.itemLocation = il;
	}
	
	/**
	 * @param pic the picture to set
	 */
	public void setPicture(byte[] pic){
		this.picture = pic;
	}

	/**
	 * 
	 * @return The id of the picture for this item
	 */
	public byte[] getPicture() {
		return picture;
	}
	
	/**
	 * Should always return false (Overridden in LostItem)
	 * @return True if the item is a lost item and false otherwise
	 */
	public boolean isLostItem(){
		return false;
	}
	
	/**
	 * 
	 * @return The date that this item was reported
	 */
	public CustomDate getDateEntered() {
		return dateEntered;
	}

	/**
	 * 
	 * @param dateEntered The date that this item was reported
	 */
	public void setDateEntered(CustomDate dateEntered) {
		this.dateEntered = dateEntered;
	}
	

}
